import java.util.*;


/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: hp
 * Date: 2024-04-28
 * Time: 23:18
 */
public class Test {
    public static void main(String[] args) {

    }


    public static void main3(String[] args) {
        int[] array3 = {1,1,3,3,4,5,6,8,7,8};
        HashMap<Integer,Integer> map = new HashMap<>();
        for(int i = 0; i < array3.length; i++) {
            if(map.get(array3[i]) == null) {
                map.put(array3[i],1);
            }else {
                int val = map.get(array3[i]);
                map.put(array3[i],val+1);
            }
        }

        Set<Map.Entry<Integer,Integer>> entries = map.entrySet();
        System.out.println(entries);
        for(Map.Entry<Integer,Integer> entrie : entries) {
            System.out.println(entrie);
        }
       /* for(Map.Entry<Integer,Integer> entrie : entries) {
            System.out.println("数字: " + entrie.getKey() + " 次数: " + entrie.getValue());
        }*/
    }

    public static void main2(String[] args) {
        HashSet<Integer> set2 = new HashSet<>();
        int[] array2 = {1,1,3,3,4,5,6,8,7,8};
        for(int x : array2) {
            set2.add(x);
        }
        System.out.println(set2);
    }


    /*public static void main1(String[] args) {
        HashSet<Integer> set1 = new HashSet<>();
        int[] array1 = {1,3,4,1,3,4,6,7,8,4};
        for(int x : array1) {
            if(!set1.contains(x)) {
                set1.add(x);
            }else {
                System.out.println(x);
                break;
            }
        }
    }*/
}
